home *** CD-ROM | disk | FTP | other *** search
/ Take-Home Tutor en Espanol / TakeHomeTutor.iso / pc / En espanol / Take-Home Tutor 3 / template4.swf / scripts / frame_1 / DoAction.as
Encoding:
Text File  |  2003-10-20  |  53.9 KB  |  2,006 lines

  1. function ext_XML_GET_TEXT()
  2. {
  3.    return this.firstChild.nodeType != 3 ? null : this.firstChild.nodeValue;
  4. }
  5. function ext_XML_SET_TEXT(text)
  6. {
  7.    this.firstChild.nodeValue = text;
  8. }
  9. function ActivityInfoItem()
  10. {
  11. }
  12. function ActivityInfo()
  13. {
  14. }
  15. function createIndexList(str, openTag, closeTag)
  16. {
  17.    var len = str.length;
  18.    var acntr = 0;
  19.    var otag = openTag;
  20.    var ctag = closeTag;
  21.    var abi = [];
  22.    var aei = [];
  23.    while(acntr < len)
  24.    {
  25.       acntr = str.indexOf(otag,acntr);
  26.       if(acntr == -1)
  27.       {
  28.          break;
  29.       }
  30.       abi.push(acntr);
  31.       acntr += otag.length;
  32.    }
  33.    acntr = 0;
  34.    while(acntr < len)
  35.    {
  36.       acntr = str.indexOf(ctag,acntr);
  37.       if(acntr == -1)
  38.       {
  39.          break;
  40.       }
  41.       aei.push(acntr);
  42.       acntr += ctag.length;
  43.    }
  44.    var rf = otag.length + ctag.length;
  45.    var i = 0;
  46.    while(i < abi.length)
  47.    {
  48.       if(i == 0)
  49.       {
  50.          aei[i] -= ctag.length - 1;
  51.       }
  52.       else
  53.       {
  54.          abi[i] -= rf * i;
  55.          aei[i] -= rf * i + otag.length;
  56.       }
  57.       i++;
  58.    }
  59.    return {startIndex:abi,endIndex:aei,length:abi.length};
  60. }
  61. function createInstructionField(cnt, name, text)
  62. {
  63.    text = simpleReplaceBlanks(text,"[:blank:]","[:/blank:]");
  64.    var hasBold = text.indexOf("[:bold:]") != -1;
  65.    if(cnt[name] == null)
  66.    {
  67.       var tmc = cnt.createEmptyMovieClip(name,1667);
  68.       tmc.createTextField("content",1,0,0,0,0);
  69.    }
  70.    else
  71.    {
  72.       var tmc = cnt[name];
  73.       tmc.swapDepths(1667);
  74.    }
  75.    tmc.isRemoveable = true;
  76.    tmc.isRemovable = true;
  77.    var tf = layoutInfo.instTextFormat;
  78.    tmc.content.border = false;
  79.    tmc.content.type = "dynamic";
  80.    if(hasBold)
  81.    {
  82.       tmc.content.text = text.replace("[:bold:]","").replace("[:/bold:]","");
  83.    }
  84.    else
  85.    {
  86.       tmc.content.text = text;
  87.    }
  88.    tmc.content._height = 400;
  89.    tmc.content.wordWrap = true;
  90.    tmc.content.color = layoutInfo.instTextColor;
  91.    tmc.content._width = 300;
  92.    tmc.content.autoSize = true;
  93.    tmc.content.selectable = false;
  94.    tmc.content.setTextFormat(tf);
  95.    tmc.content.embedFonts = true;
  96.    if(hasBold)
  97.    {
  98.       var idxLists = createIndexList(text,"[:bold:]","[:/bold:]");
  99.       var i = 0;
  100.       while(i < idxLists.length)
  101.       {
  102.          tmc.content.setTextFormat(idxLists.startIndex[i],idxLists.endIndex[i],layoutInfo.instTextFormatBold);
  103.          i++;
  104.       }
  105.    }
  106.    return tmc;
  107. }
  108. function changeInstructionField(insField, newText)
  109. {
  110.    createInstructionField(insField._parent,insField._name,newText);
  111. }
  112. function toggleLang()
  113. {
  114.    if(PMSI.instructionLanguage == "Spanish")
  115.    {
  116.       PMSI.instructionLanguage = "English";
  117.    }
  118.    else
  119.    {
  120.       PMSI.instructionLanguage = "Spanish";
  121.    }
  122.    var instText = ai["instructions" + PMSI.instructionLanguage].text;
  123.    if(instText != null)
  124.    {
  125.       var oldInstHeight = this.instructionField._height;
  126.       changeInstructionField(this.instructionField,instText);
  127.       var hdiff = this.instructionField._height - oldInstHeight;
  128.       reposition(hdiff);
  129.    }
  130.    pencilHelper.swapLangs();
  131. }
  132. function reposition(hdiff)
  133. {
  134.    var comp;
  135.    var dupList = {};
  136.    trace("******************************************");
  137.    for(var mcn in this)
  138.    {
  139.       comp = this[mcn];
  140.       if(comp.isMoveable && dupList[comp._name] == null)
  141.       {
  142.          trace("\t" + comp);
  143.          trace("\t\t" + comp.getDepth());
  144.          trace(hdiff);
  145.          comp._y += hdiff;
  146.          dupList[comp._name] = 1;
  147.       }
  148.    }
  149.    trace("******************************************");
  150. }
  151. function simpleReplaceBlanks(str, stag, etag)
  152. {
  153.    var cp = str.indexOf(stag);
  154.    var ei = 0;
  155.    while(cp != -1)
  156.    {
  157.       ei = str.indexOf(etag);
  158.       str = str.substring(0,cp) + "_____" + str.substring(ei + etag.length);
  159.       cp = str.indexOf(stag);
  160.    }
  161.    return str;
  162. }
  163. function loadActivity(fname)
  164. {
  165.    t = getTimer();
  166.    ai.load(fname);
  167. }
  168. function setActivityInfo(_ai)
  169. {
  170.    ai = _ai;
  171.    ai._parent = this;
  172.    render();
  173.    return true;
  174. }
  175. function render()
  176. {
  177.    delete imageArray;
  178.    imageArray = new Array();
  179.    tabOrder = 4000;
  180.    this.hasImages = false;
  181.    if(_parent == null)
  182.    {
  183.       this.lineStyle(1,0,100);
  184.       this.drawRect(0,0,Stage.width,Stage.height);
  185.    }
  186.    clearClip();
  187.    this.attachMovie("pencil","pencil",60001);
  188.    pencil.isRemovable = true;
  189.    pencilSelected = false;
  190.    if(this.needsTip == true)
  191.    {
  192.       this.attachMovie("pencil_tip","pencilHelper",70000);
  193.       pencilHelper.isRemovable = true;
  194.    }
  195.    pencil.isRemovable = true;
  196.    pencil.swapDepths(60001);
  197.    pencilHelper.swapDepths(60000);
  198.    pencil._visible = false;
  199.    resetBubbleTimer();
  200.    tableY = layoutInfo.box.y;
  201.    rightSideBuffer = layoutInfo.rightSideBuffer;
  202.    topBuffer = 0;
  203.    if(master.hasVideoPlayer)
  204.    {
  205.       tableY = layoutInfo.temp4InstY;
  206.       topBuffer = master.videoPlayer._height;
  207.       rightSideBuffer = 250;
  208.    }
  209.    else if(master.hasMediaFrame)
  210.    {
  211.       rightSideBuffer = 250;
  212.    }
  213.    table = new TableClass(this);
  214.    trace(this + ".render: called");
  215.    var title_mc;
  216.    var inst_mc;
  217.    if(ai.titleSpanish)
  218.    {
  219.       title_mc = createTitleField(ai.titleSpanish);
  220.       title_mc.isRemovable = true;
  221.       title_mc._x = layoutInfo.box.x;
  222.       title_mc._y = layoutInfo.box.y + topBuffer;
  223.       tableY = title_mc._y + title_mc._height;
  224.    }
  225.    if(ai.instructionsEnglish == null && ai.instructionsSpanish == null)
  226.    {
  227.       ai.instructionsEnglish = {text:ai.questions.question.questionText.text};
  228.       ai.instructionsSpanish = {text:ai.questions.question.questionTextSpanish.text};
  229.       ai.questions.question.questionText = null;
  230.       ai.questions.question.questionTextSpanish = null;
  231.    }
  232.    if(ai.instructionsEnglish || ai.instructionsSpanish)
  233.    {
  234.       if(ai.instructionsEnglish != null)
  235.       {
  236.          var instText = ai.instructionsEnglish.text;
  237.       }
  238.       else
  239.       {
  240.          var instText = ai.instructionsSpanish.text;
  241.       }
  242.       pinstText = ai["instructions" + PMSI.instructionLanguage].text;
  243.       instText = pinstText != null ? pinstText : instText;
  244.       inst_mc = this.createInstructionField(this,"inst",instText);
  245.       inst_mc.isRemovable = true;
  246.       inst_mc._x = layoutInfo.box.x;
  247.       inst_mc._y = title_mc == null ? tableY : title_mc._y + title_mc._height;
  248.       trace("INST Y: " + inst_mc._y);
  249.       this.instructionField = inst_mc;
  250.       tableY = inst_mc._y + inst_mc._height;
  251.    }
  252.    if(ai.reference != null)
  253.    {
  254.       this._parent.showRefWinButton(layoutInfo.box.x,tableY);
  255.    }
  256.    if(_parent.actNumber_mc._height > inst_mc._height + title_mc._height)
  257.    {
  258.       tableY = _parent.actNumber_mc._y + _parent.actNumber_mc._height + 10;
  259.    }
  260.    else
  261.    {
  262.       tableY += 10;
  263.    }
  264.    var questionY = 0;
  265.    var qlen = ai.questions.question.length;
  266.    var qs = ai.questions.question;
  267.    var ans = ai.wordbank.word;
  268.    var qlen = qs.length;
  269.    container.clampsLeft = new Array(qlen);
  270.    container.clampsRight = new Array(qlen);
  271.    var clwid = layoutInfo.matchingCircleLineThickness;
  272.    var crad = layoutInfo.matchingCircleRadius;
  273.    var cwid = crad + clwid;
  274.    var voff = layoutInfo.matchingCircleVertOffset;
  275.    var dboxw = cwid * 2;
  276.    var i = 0;
  277.    while(i < qlen)
  278.    {
  279.       tr = new TableRow();
  280.       var mc;
  281.       if(ai.questions.question[i].questionText != null)
  282.       {
  283.          this.hasImages = false;
  284.          mc = container.createQuestionField(i,ai.questions.question[i].questionText);
  285.       }
  286.       else
  287.       {
  288.          mc = container.attachMovie("imgPlaceHolder","img" + i,5200 + i);
  289.          mc._visible = false;
  290.          imageArray.push(mc);
  291.          this.hasImages = true;
  292.          imageLoader.addImage({clip:mc.createEmptyMovieClip("img",1),url:"artfiles/" + ai.questions.question[i].artFile});
  293.       }
  294.       mc.isRemovable = true;
  295.       mc.isMoveable = true;
  296.       if(this.hasImages)
  297.       {
  298.          voff = 0;
  299.       }
  300.       cmc = container.createEmptyMovieClip("qcirc" + i,4200 + i);
  301.       cmc.lineStyle(clwid,layoutInfo.matchingCircleColor,100);
  302.       cmc.beginFill(16777215);
  303.       cmc.drawOval(cwid,cwid + voff,crad);
  304.       cmc.voff = voff;
  305.       cmc.endFill();
  306.       cmc.isRemovable = true;
  307.       cmc.isMoveable = true;
  308.       cmc.answerText = ai.questions.question[i].correctAnswer.text;
  309.       clampsLeft[i] = cmc;
  310.       cmc.tabIndex = tabOrder++;
  311.       amc = container.createEmptyMovieClip("acirc" + i,4300 + i);
  312.       amc.lineStyle(clwid,layoutInfo.matchingCircleColor,100);
  313.       amc.beginFill(16777215);
  314.       amc.drawOval(cwid,cwid + voff,crad);
  315.       amc.voff = voff;
  316.       amc.endFill();
  317.       amc.isRemovable = true;
  318.       amc.isMoveable = true;
  319.       amc.answerText = ans[i].text;
  320.       clampsRight[i] = amc;
  321.       amc.tabIndex = tabOrder++;
  322.       var rst = createAnswerField(i,1,ans[i]);
  323.       rst.isRemovable = true;
  324.       rst.isMoveable = true;
  325.       var spacer = createAnswerSpacer(id);
  326.       spacer.isRemovable = true;
  327.       spacer.isMoveable = true;
  328.       feedbackCheck = this.attachMovie("check","correctcheck_" + i,4400 + i);
  329.       feedbackCheck.isRemovable = true;
  330.       feedbackCheck.isMoveable = true;
  331.       amc.feedbackCheck = feedbackCheck;
  332.       cmc.feedbackCheck = feedbackCheck;
  333.       tc0 = new TableCell(feedbackCheck);
  334.       tc0.setVAlign("center");
  335.       tc1 = new TableCell(mc);
  336.       tc2 = new TableCell(cmc);
  337.       tc2.setHAlign("center");
  338.       if(this.hasImages)
  339.       {
  340.          tc2.setVAlign("center");
  341.       }
  342.       tc3 = new TableCell(spacer);
  343.       tc4 = new TableCell(amc);
  344.       tc4.setHAlign("center");
  345.       if(this.hasImages)
  346.       {
  347.          tc4.setVAlign("center");
  348.       }
  349.       tc5 = new TableCell(rst);
  350.       if(this.hasImages)
  351.       {
  352.          tc5.setVAlign("center");
  353.       }
  354.       tr.addCell(tc0);
  355.       tr.addCell(tc1);
  356.       tr.addCell(tc2);
  357.       tr.addCell(tc3);
  358.       tr.addCell(tc4);
  359.       tr.addCell(tc5);
  360.       table.addRow(tr);
  361.       i++;
  362.    }
  363.    if(this.hasImages == null || this.hasImages == false)
  364.    {
  365.       table.setBorder(0);
  366.       leftAdjust = 0;
  367.       table.setPosition({x:layoutInfo.box.x + leftAdjust,y:tableY + 4});
  368.       table.setCellSpacing(6);
  369.       table.init();
  370.       trace("TABLE WIDTH: " + (layoutInfo.MAX_WIDTH - rightSideBuffer));
  371.       trace("TABLE Y: " + tableY);
  372.       var twid = layoutInfo.MAX_WIDTH - rightSideBuffer - 10;
  373.       table.setWidth(layoutInfo.MAX_WIDTH - rightSideBuffer - 20);
  374.    }
  375.    clamps = clampsLeft.concat(clampsRight);
  376.    var i = 0;
  377.    while(i < clampsLeft.length)
  378.    {
  379.       clampsLeft[i].leftClamp = true;
  380.       clampsLeft[i].onPress = startLine;
  381.       clampsLeft[i].onRelease = stopLine;
  382.       clampsLeft[i].onReleaseOutside = clampReleaseOutside;
  383.       clampsLeft[i].useHandCursor = false;
  384.       clampsLeft[i].onRollOver = clampRollOver;
  385.       clampsLeft[i].onRollOut = clampRollOut;
  386.       i++;
  387.    }
  388.    var i = 0;
  389.    while(i < clampsRight.length)
  390.    {
  391.       clampsRight[i].rightClamp = true;
  392.       clampsRight[i].onPress = startLine;
  393.       clampsRight[i].onRelease = stopLine;
  394.       clampsRight[i].onReleaseOutside = clampReleaseOutside;
  395.       clampsRight[i].useHandCursor = false;
  396.       clampsRight[i].onRollOver = clampRollOver;
  397.       clampsRight[i].onRollOut = clampRollOut;
  398.       i++;
  399.    }
  400.    trace("SETTING PENCIL HELPER: x: " + clampsRight);
  401.    pencilHelper._x = clamps[0]._x + clamps[0]._width;
  402.    pencilHelper._y = clamps[0]._y + clamps[0]._height / 2;
  403.    pencilHelper.isMoveable = true;
  404.    if(this.hasImages)
  405.    {
  406.       for(var mcn in this)
  407.       {
  408.          if(this[mcn].isRemovable)
  409.          {
  410.             this[mcn]._visible = false;
  411.          }
  412.       }
  413.       imageLoader.start();
  414.    }
  415. }
  416. function clampReleaseOutside()
  417. {
  418.    stopLine(this);
  419.    pencil._visible = false;
  420.    Mouse.show();
  421. }
  422. function clampRollOver()
  423. {
  424.    pencil._visible = true;
  425.    pencilSelected = true;
  426.    pencil._x = _root._xmouse;
  427.    pencil._y = _root._ymouse;
  428.    pencilHolder.onRelease = pencilHolderRelease;
  429.    Mouse.hide();
  430.    pencil.onMouseMove = pencilOnMouseMove;
  431. }
  432. function clampRollOut()
  433. {
  434.    pencilSelected = true;
  435.    pencil._visible = false;
  436.    delete pencilHolder.onRelease;
  437.    Mouse.show();
  438. }
  439. function pencilOnMouseMove()
  440. {
  441.    this._x = _root._xmouse;
  442.    this._y = _root._ymouse;
  443.    updateAfterEvent();
  444. }
  445. function startLine()
  446. {
  447.    if(pencilSelected)
  448.    {
  449.       this.line.clear();
  450.       this.line.removeMovieClip();
  451.       delete this.line;
  452.       this.targetline.clear();
  453.       this.targetline = null;
  454.       if(this.line == null)
  455.       {
  456.          container.drawLines_mcs.level = container.drawLines_mcs.level + 1;
  457.          this.line = container.createEmptyMovieClip("__drawline__" + container.drawLines_mcs.level,container.drawLines_mcs.level);
  458.          container.drawLines_mcs[this] = this.line;
  459.          this.line.createTextField("no",0,0,30,30);
  460.          this.line.no.text = container.drawLines_mcs.level;
  461.          this.line.isRemovable = true;
  462.          this.line.isMoveable = true;
  463.       }
  464.       container._currentClamp = this;
  465.       this._orgX = _root._xmouse;
  466.       this._orgY = _root._ymouse;
  467.       this.onMouseMove = container.drawLine;
  468.    }
  469. }
  470. function drawLine()
  471. {
  472.    var lx = _root._xmouse;
  473.    var ly = _root._ymouse;
  474.    var ox = this._orgX;
  475.    var oy = this._orgY;
  476.    if(container._snapLines && !container._snapAfter)
  477.    {
  478.       var targ = container.checkForHit(this);
  479.       if(targ)
  480.       {
  481.          var tpt = targ.getCenterPoint();
  482.          targ.localToGlobal(tpt);
  483.          lx = tpt.x;
  484.          ly = tpt.y + this.voff;
  485.       }
  486.       var mpt = this.getCenterPoint();
  487.       this.localToGlobal(mpt);
  488.       ox = mpt.x;
  489.       oy = mpt.y + this.voff;
  490.    }
  491.    this.line.clear();
  492.    this.line.lineStyle(3,lineColor,lineAlpha);
  493.    this.line.moveTo(ox,oy);
  494.    this.line.lineTo(lx,ly);
  495.    updateAfterEvent();
  496. }
  497. function stopLine(targetClip)
  498. {
  499.    var thisTarg = targetClip != null ? targetClip : this;
  500.    var targ = container.checkForHit(thisTarg);
  501.    if(container._snapAfter)
  502.    {
  503.       thisTarg.line.clear();
  504.       thisTarg.line.lineStyle(3,lineColor,70);
  505.       thisTarg.line.moveTo(thisTarg._x,thisTarg._y);
  506.       thisTarg.line.lineTo(targ._x,targ._y);
  507.    }
  508.    if(targ.line != targ.targetline)
  509.    {
  510.       targ.line.clear();
  511.    }
  512.    targ.targetline.clear();
  513.    targ.targetline = thisTarg.line;
  514.    if(targ == null)
  515.    {
  516.       thisTarg.line.clear();
  517.       delete targ._matchTo;
  518.       delete thisTarg._matchTo;
  519.    }
  520.    else
  521.    {
  522.       pencilHelper.gotoAndStop(1);
  523.       pencilHelper.unloadMovie();
  524.       pencilHelper.neverRunAgain = true;
  525.       needsTip = false;
  526.       neverRunPencilTipAgain = true;
  527.       targ._matchTo = thisTarg;
  528.       thisTarg._matchTo = targ;
  529.    }
  530.    delete thisTarg.onMouseMove;
  531. }
  532. function checkForHit(oClamp)
  533. {
  534.    var clamp = null;
  535.    var i = 0;
  536.    while(i < clamps.length)
  537.    {
  538.       clamp = clamps[i];
  539.       if(clamp.hitTest(_root._xmouse,_root._ymouse) && !(clamp.rightClamp && oClamp.rightClamp) && !(clamp.leftClamp && oClamp.leftClamp))
  540.       {
  541.          return clamp;
  542.       }
  543.       i++;
  544.    }
  545.    return null;
  546. }
  547. function pencilHolderRelease()
  548. {
  549.    pencilSelected = false;
  550.    delete pencil.onMouseMove;
  551.    Mouse.show();
  552.    checkAnswers();
  553.    delete pencilHolder.onRelease;
  554. }
  555. function changeSnap()
  556. {
  557.    container._snapAfter = snapAfterRB.getState();
  558.    container._snapLines = snapDuringRB.getState();
  559. }
  560. function checkAnswers()
  561. {
  562.    var correct = 0;
  563.    var cml;
  564.    var cmlm;
  565.    var i = 0;
  566.    while(i < clampsLeft.length)
  567.    {
  568.       cml = clampsLeft[i].answerText;
  569.       cmlm = clampsLeft[i]._matchTo.answerText;
  570.       if(cml == cmlm)
  571.       {
  572.          correct++;
  573.          clampsLeft[i].feedbackCheck.gotoAndStop("correct");
  574.       }
  575.       else
  576.       {
  577.          clampsLeft[i].feedbackCheck.gotoAndStop("incorrect");
  578.       }
  579.       i++;
  580.    }
  581.    master.setFeedback(correct,clampsLeft.length);
  582. }
  583. function createQuestionField(id, text)
  584. {
  585.    var mc = this.createEmptyMovieClip("question" + id,4500 + id);
  586.    mc.createTextField("content",1,0,0,0,0);
  587.    var tf = layoutInfo.qTextFormatMATCH;
  588.    mc.content.embedFonts = true;
  589.    mc.content.border = false;
  590.    mc.content.type = "dynamic";
  591.    mc.content.text = text;
  592.    mc.content.autoSize = true;
  593.    mc.content.setTextFormat(tf);
  594.    mc.content.selectable = false;
  595.    return mc;
  596. }
  597. function createAnswerField(id, subid, text)
  598. {
  599.    var amc1 = this.createEmptyMovieClip("answer" + subid + "_" + id,4600 + id);
  600.    amc1.createTextField("content",1,0,0,0,0);
  601.    var tf2 = layoutInfo.answerTextFormat1;
  602.    amc1.content.embedFonts = true;
  603.    amc1.content.border = false;
  604.    amc1.content.type = "dynamic";
  605.    amc1.content.text = text;
  606.    amc1.content.autoSize = true;
  607.    amc1.content.selectable = false;
  608.    amc1.content.setTextFormat(tf2);
  609.    return amc1;
  610. }
  611. function createAnswerFieldStatic(id, subid, text)
  612. {
  613.    var amc1 = this.createEmptyMovieClip("answer" + subid + "_" + id,4700 + id);
  614.    amc1.createTextField("content",1,0,0,0,0);
  615.    var tf2 = layoutInfo.answerTextFormat1;
  616.    amc1.content.embedFonts = true;
  617.    amc1.content.border = false;
  618.    amc1.content.type = "dynamic";
  619.    amc1.content.text = text;
  620.    amc1.content.autoSize = true;
  621.    amc1.content.selectable = false;
  622.    amc1.content.setTextFormat(tf2);
  623.    return amc1;
  624. }
  625. function createAnswerSpacer(id)
  626. {
  627.    var amcSpacer = this.createEmptyMovieClip("answerSpacer_" + id,4800 + id);
  628.    amcSpacer.createTextField("content",1,0,0,0,0);
  629.    var tf2 = layoutInfo.answerTextFormat1;
  630.    amcSpacer.content.embedFonts = true;
  631.    amcSpacer.content.border = false;
  632.    amcSpacer.content.type = "dynamic";
  633.    amcSpacer.content.text = "    ";
  634.    amcSpacer.content.autoSize = true;
  635.    amcSpacer.content.setTextFormat(tf2);
  636.    amcSpacer.content.selectable = false;
  637.    return amcSpacer;
  638. }
  639. function createTitleField(txt)
  640. {
  641.    var mc = this.createEmptyMovieClip("title",4900);
  642.    mc.createTextField("content",1,0,0,0,0);
  643.    var tf = layoutInfo.titleTextFormat;
  644.    mc.content.embedFonts = true;
  645.    mc.content.border = false;
  646.    mc.content.type = "dynamic";
  647.    mc.content.text = txt;
  648.    mc.content.setTextFormat(tf);
  649.    mc.content.wordWrap = true;
  650.    mc.content.color = layoutInfo.instTextColor;
  651.    mc.content._width = 300;
  652.    mc.content.autoSize = true;
  653.    mc.content.selectable = false;
  654.    return mc;
  655. }
  656. function clearClip()
  657. {
  658.    delete clampsLeft;
  659.    delete clampsRight;
  660.    delete clamps;
  661.    delete table;
  662.    pencilHelper.gotoAndStop(1);
  663.    layoutInfo.qMaxWidthPos = 0;
  664.    layoutInfo.qMaxWidth = 0;
  665.    layoutInfo.a1MaxWidth = 0;
  666.    layoutInfo.a2MaxWidth = 0;
  667.    for(var mcn in this)
  668.    {
  669.       if(this[mcn].isRemovable)
  670.       {
  671.          trace("Deleting: " + mcn);
  672.          this[mcn].clear();
  673.          this[mcn].removeMovieClip();
  674.       }
  675.    }
  676. }
  677. function bubbleHelpInterval()
  678. {
  679.    pencilHelper.gotoAndStop(1);
  680.    if(!PMSI.isVideoPlaying && bubblePlayCounter <= bubblePlayMax)
  681.    {
  682.       bubblePlayCounter++;
  683.       pencilHelper.play();
  684.       clearInterval(bubbleHelpIntId);
  685.    }
  686. }
  687. function resetBubbleTimer()
  688. {
  689.    pencilHelper.gotoAndStop(1);
  690.    if(pencilHelper != undefined)
  691.    {
  692.       clearInterval(bubbleHelpIntId);
  693.       bubbleHelpIntId = setInterval(this,"bubbleHelpInterval",bubbleHelpSleepTime * 1000);
  694.    }
  695. }
  696. if(_global.PMSI == null)
  697. {
  698.    _global.PMSI = {};
  699.    PMSI.VENDOR_NAME = "Purple Monkey Studios, Inc.";
  700.    PMSI.DefList = {};
  701. }
  702. String.prototype.trim = function()
  703. {
  704.    return this.rtrim().ltrim();
  705. };
  706. String.prototype.rtrim = function()
  707. {
  708.    var i = this.length - 1;
  709.    while(i >= 0 && this.charCodeAt(i) <= 32)
  710.    {
  711.       i--;
  712.    }
  713.    return this.substring(0,i + 1);
  714. };
  715. String.prototype.ltrim = function()
  716. {
  717.    var i = 0;
  718.    while(i < this.length && this.charCodeAt(i) <= 32)
  719.    {
  720.       i++;
  721.    }
  722.    return this.substring(i);
  723. };
  724. String.prototype.isWhiteSpace = function()
  725. {
  726.    var i = 0;
  727.    while(i < this.length)
  728.    {
  729.       if(this.charCodeAt(i) > 32)
  730.       {
  731.          return false;
  732.       }
  733.       i++;
  734.    }
  735.    return true;
  736. };
  737. String.prototype.toCharArray = function()
  738. {
  739.    return this.split("");
  740. };
  741. Array.prototype.charArrayToString = function()
  742. {
  743.    return this.join("");
  744. };
  745. String.prototype.reverse = function()
  746. {
  747.    return this.split("").reverse().join("");
  748. };
  749. String.prototype.multiSplit = function()
  750. {
  751.    var master;
  752.    var dummy;
  753.    var args;
  754.    master = this.split(arguments[0]);
  755.    var i = 1;
  756.    while(i < arguments.length)
  757.    {
  758.       var j = 0;
  759.       while(j < master.length)
  760.       {
  761.          dummy = master[j].split(arguments[i]);
  762.          if(dummy.length > 1)
  763.          {
  764.             args = [j,1];
  765.             args = args.concat(dummy);
  766.             master.splice.apply(master,args);
  767.          }
  768.          j++;
  769.       }
  770.       i++;
  771.    }
  772.    return master;
  773. };
  774. String.prototype.replace = function(srch, repl)
  775. {
  776.    return this.split(srch).join(repl);
  777. };
  778. XML.prototype.ELEMENT_NODE = 1;
  779. XML.prototype.TEXT_NODE = 3;
  780. XML.prototype._inorderItr = function(node, fnPtr)
  781. {
  782.    var stack = new Array();
  783.    var node = node;
  784.    while(true)
  785.    {
  786.       if(node)
  787.       {
  788.          stack.push(node);
  789.          node = node.firstChild;
  790.       }
  791.       else
  792.       {
  793.          node = stack.pop();
  794.          if(!node)
  795.          {
  796.             break;
  797.          }
  798.          fnPtr(node);
  799.          node = node.nextSibling;
  800.       }
  801.    }
  802.    delete stack;
  803. };
  804. XMLNode.prototype._inorderItr = XML.prototype._inorderItr;
  805. XML.prototype._inorderRec = function(node, fnPtr)
  806. {
  807.    function helperR(node_xml)
  808.    {
  809.       if(node_xml == null)
  810.       {
  811.          return undefined;
  812.       }
  813.       this.fnPtr(node_xml);
  814.       helperR(node_xml.firstChild);
  815.       helperR(node_xml.nextSibling);
  816.    }
  817.    var outer = this;
  818.    helperR(node);
  819. };
  820. XMLNode.prototype._inorderRec = XML.prototype._inorderRec;
  821. XMLNode.prototype.addProperty("text",this.ext_XML_GET_TEXT,this.ext_XML_SET_TEXT);
  822. XML.prototype.addProperty("text",this.ext_XML_GET_TEXT,this.ext_XML_SET_TEXT);
  823. XML.prototype.getElementsByTagName = function(tagName)
  824. {
  825.    function processNode(node)
  826.    {
  827.       if(node.nodeName != null && node.nodeName == tagName)
  828.       {
  829.          nodelist.push(node);
  830.       }
  831.    }
  832.    var nodelist = new Array();
  833.    this._inorderItr(this,processNode);
  834.    return nodelist;
  835. };
  836. XMLNode.prototype.getElementsByTagName = XML.prototype.getElementsByTagName;
  837. XML.prototype.getElementsByTagNames = function()
  838. {
  839.    function processNode(node)
  840.    {
  841.       var i = 0;
  842.       while(i < args.length)
  843.       {
  844.          if(node.nodeName != null && node.nodeName == args[i])
  845.          {
  846.             trace("Found: " + args[i]);
  847.             if(nodelists[i] == undefined)
  848.             {
  849.                nodelists[i] = new Array();
  850.             }
  851.             nodelists[i].push(node);
  852.             break;
  853.          }
  854.          i++;
  855.       }
  856.    }
  857.    var args = arguments;
  858.    var nodelists = new Array(arguments.length);
  859.    this._inorderItr(this,processNode);
  860.    return nodelists;
  861. };
  862. XMLNode.prototype.getElementsByTagNames = XML.prototype.getElementsByTagNames;
  863. XML.prototype.getValueAtTagName = function(tagName)
  864. {
  865.    function processNode(node)
  866.    {
  867.       if(node.nodeName != null && node.nodeName == tagName)
  868.       {
  869.          nodelist.push(node);
  870.       }
  871.    }
  872.    var nodelist = new Array();
  873.    var textValue = null;
  874.    this._inorderItr(this,processNode);
  875.    if(nodeList.length >= 1)
  876.    {
  877.       textValue = nodeList[0].text;
  878.    }
  879.    return textValue;
  880. };
  881. XMLNode.prototype.getValueAtTagName = XML.prototype.getValueAtTagName;
  882. XML.prototype.getAttribute = function(name)
  883. {
  884.    return this.attributes[name];
  885. };
  886. XMLNode.prototype.getAttribute = XML.prototype.getAttribute;
  887. XML.prototype.setAttribute = function(name, value)
  888. {
  889.    this.attributes[name] = value;
  890. };
  891. XMLNode.prototype.setAttribute = XML.prototype.setAttribute;
  892. XML.prototype.hasAttribute = function(name)
  893. {
  894.    var attrs = this.attributes;
  895.    for(var mc in attrs)
  896.    {
  897.       if(name == mc)
  898.       {
  899.          return true;
  900.       }
  901.    }
  902.    return false;
  903. };
  904. XMLNode.prototype.hasAttribute = XML.prototype.hasAttribute;
  905. XML.prototype.removeAttribute = function(name)
  906. {
  907.    var attr = this.attributes[name];
  908.    delete this.attributes[name];
  909.    return attr;
  910. };
  911. XMLNode.prototype.setAttribute = XML.prototype.setAttribute;
  912. XMLNode.prototype.getOwnerDocument = function()
  913. {
  914.    var odc = this;
  915.    var lastNode = this;
  916.    while(odc)
  917.    {
  918.       lastNode = odc;
  919.       odc = odc.parentNode;
  920.    }
  921.    return !(lastNode instanceof XML) ? null : lastNode;
  922. };
  923. XML.prototype.normalize = function()
  924. {
  925.    function process(node)
  926.    {
  927.       nodeList.push(node);
  928.    }
  929.    var outer = this;
  930.    var nodeList = new Array();
  931.    this._inorderItr(this,process);
  932.    var i = 0;
  933.    while(i < nodeList.length)
  934.    {
  935.       var node = nodeList[i];
  936.       if(node.nodeType == XML.prototype.TEXT_NODE && node.nodeValue.isWhiteSpace())
  937.       {
  938.          trace("removing node");
  939.          node.removeNode();
  940.       }
  941.       else if(node.nodeType == XML.prototype.TEXT_NODE)
  942.       {
  943.          node.nodeValue = node.nodeValue.trim();
  944.       }
  945.       i++;
  946.    }
  947.    delete nodeList;
  948. };
  949. XMLNode.prototype.normalize = XML.prototype.normalize;
  950. XMLNode.prototype.getDepth = function()
  951. {
  952.    var i = 0;
  953.    var node = this;
  954.    while(node)
  955.    {
  956.       node = node.parentNode;
  957.       i++;
  958.    }
  959.    return i;
  960. };
  961. XML.prototype.getElementsWithAttribute = function(name, value)
  962. {
  963.    function processNode(node)
  964.    {
  965.       if(value == null)
  966.       {
  967.          for(var mcz in node.attributes)
  968.          {
  969.             if(mcz == name)
  970.             {
  971.                nodeList.push(node);
  972.                break;
  973.             }
  974.          }
  975.       }
  976.       else if(node.attributes[name] == value)
  977.       {
  978.          nodeList.push(node);
  979.       }
  980.    }
  981.    if(name == null)
  982.    {
  983.       return undefined;
  984.    }
  985.    var nodeList = new Array();
  986.    this._inorderItr(this,processNode);
  987.    return nodeList;
  988. };
  989. XMLNode.prototype.getElementsWithAttribute = XML.prototype.getElementsWithAttribute;
  990. XMLNode.prototype.getPath = function(path)
  991. {
  992.    function process(node)
  993.    {
  994.       trace(node.nodeName);
  995.       if(node.nodeName != null && node.nodeName == currentPart && i < pathParts.length)
  996.       {
  997.          trace("Found: " + currentPart);
  998.          partTable[i] = node.parentNode.getElementsByTagName(currentPart);
  999.          currentPart = pathParts[++i];
  1000.       }
  1001.    }
  1002.    var i = 0;
  1003.    var pathParts = path.split("/");
  1004.    var currentPart = pathParts[i];
  1005.    var partTable = new Array();
  1006.    this._inorderItr(this,process);
  1007.    return partTable[partTable.length - 1];
  1008. };
  1009. XML.prototype.getPath = XMLNode.prototype.getPath;
  1010. MovieClip.prototype.isLoading = function()
  1011. {
  1012.    return this.getBytesLoaded() > 4 && this.getBytesTotal() > this.getBytesLoaded();
  1013. };
  1014. MovieClip.prototype.getPercentLoaded = function()
  1015. {
  1016.    return Math.round(this.getBytesLoaded() / this.getBytesTotal() * 100);
  1017. };
  1018. MovieClip.prototype.isLoaded = function()
  1019. {
  1020.    return !this.isLoading();
  1021. };
  1022. MovieClip.prototype._sol = function(f)
  1023. {
  1024.    if(MovieClip.prototype.__onLoadHandler__ == undefined)
  1025.    {
  1026.       MovieClip.prototype.__onLoadHandler__ = {};
  1027.    }
  1028.    MovieClip.prototype.__onLoadHandler__[this] = f;
  1029. };
  1030. MovieClip.prototype._gol = function()
  1031. {
  1032.    return MovieClip.prototype.__onLoadHandler__[this];
  1033. };
  1034. MovieClip.prototype.addProperty("onLoad",MovieClip.prototype._gol,MovieClip.prototype._sol);
  1035. MovieClip.prototype._sod = function(f)
  1036. {
  1037.    if(MovieClip.prototype.__onDataHandler__ == undefined)
  1038.    {
  1039.       MovieClip.prototype.__onDataHandler__ = {};
  1040.    }
  1041.    MovieClip.prototype.__onDataHandler__[this] = f;
  1042. };
  1043. MovieClip.prototype._god = function()
  1044. {
  1045.    return MovieClip.prototype.__onDataHandler__[this];
  1046. };
  1047. MovieClip.prototype.addProperty("onData",MovieClip.prototype._god,MovieClip.prototype._sod);
  1048. MovieClip.prototype.load = MovieClip.prototype.loadMovie;
  1049. MovieClip.prototype.drawOval = function(x, y, radius, yRadius)
  1050. {
  1051.    if(arguments.length < 3)
  1052.    {
  1053.       return undefined;
  1054.    }
  1055.    var theta;
  1056.    var xrCtrl;
  1057.    var yrCtrl;
  1058.    var angle;
  1059.    var angleMid;
  1060.    var px;
  1061.    var py;
  1062.    var cx;
  1063.    var cy;
  1064.    if(yRadius == undefined)
  1065.    {
  1066.       yRadius = radius;
  1067.    }
  1068.    theta = 0.7853981633974483;
  1069.    xrCtrl = radius / Math.cos(theta / 2);
  1070.    yrCtrl = yRadius / Math.cos(theta / 2);
  1071.    angle = 0;
  1072.    this.moveTo(x + radius,y);
  1073.    var i = 0;
  1074.    while(i < 8)
  1075.    {
  1076.       angle += theta;
  1077.       angleMid = angle - theta / 2;
  1078.       cx = x + Math.cos(angleMid) * xrCtrl;
  1079.       cy = y + Math.sin(angleMid) * yrCtrl;
  1080.       px = x + Math.cos(angle) * radius;
  1081.       py = y + Math.sin(angle) * yRadius;
  1082.       this.curveTo(cx,cy,px,py);
  1083.       i++;
  1084.    }
  1085. };
  1086. MovieClip.prototype.drawCircle = function(x, y, r)
  1087. {
  1088.    this.drawOval(x,y,r);
  1089. };
  1090. MovieClip.prototype.drawSquare = function(x, y, w)
  1091. {
  1092.    this.drawRect(x,y,w,w);
  1093. };
  1094. MovieClip.prototype.drawEgg = function(x, y, r)
  1095. {
  1096.    var rx = r / 1.618;
  1097.    var ry = r;
  1098.    var ry1 = 2 * ry * 0.618;
  1099.    var ry2 = 2 * ry * 0.382;
  1100.    this.moveTo(x + rx,y);
  1101.    this.curveTo(rx + x,-0.4142 * ry1 + y,0.7071 * rx + x,-0.7071 * ry1 + y);
  1102.    this.curveTo(0.4142 * rx + x,- ry1 + y,x,- ry1 + y);
  1103.    this.curveTo(-0.4142 * rx + x,- ry1 + y,-0.7071 * rx + x,-0.7071 * ry1 + y);
  1104.    this.curveTo(- rx + x,-0.4142 * ry1 + y,- rx + x,y);
  1105.    this.curveTo(- rx + x,0.4142 * ry2 + y,-0.7071 * rx + x,0.7071 * ry2 + y);
  1106.    this.curveTo(-0.4142 * rx + x,ry2 + y,x,ry2 + y);
  1107.    this.curveTo(0.4142 * rx + x,ry2 + y,0.7071 * rx + x,0.7071 * ry2 + y);
  1108.    this.curveTo(rx + x,0.4142 * ry2 + y,rx + x,y);
  1109. };
  1110. MovieClip.prototype.drawRect = function(x, y, w, h, cornerRadius)
  1111. {
  1112.    if(arguments.length < 4)
  1113.    {
  1114.       return undefined;
  1115.    }
  1116.    if(cornerRadius > 0)
  1117.    {
  1118.       var theta;
  1119.       var angle;
  1120.       var cx;
  1121.       var cy;
  1122.       var px;
  1123.       var py;
  1124.       if(cornerRadius > Math.min(w,h) / 2)
  1125.       {
  1126.          cornerRadius = Math.min(w,h) / 2;
  1127.       }
  1128.       theta = 0.7853981633974483;
  1129.       this.moveTo(x + cornerRadius,y);
  1130.       this.lineTo(x + w - cornerRadius,y);
  1131.       angle = -1.5707963267948966;
  1132.       cx = x + w - cornerRadius + Math.cos(angle + theta / 2) * cornerRadius / Math.cos(theta / 2);
  1133.       cy = y + cornerRadius + Math.sin(angle + theta / 2) * cornerRadius / Math.cos(theta / 2);
  1134.       px = x + w - cornerRadius + Math.cos(angle + theta) * cornerRadius;
  1135.       py = y + cornerRadius + Math.sin(angle + theta) * cornerRadius;
  1136.       this.curveTo(cx,cy,px,py);
  1137.       angle += theta;
  1138.       cx = x + w - cornerRadius + Math.cos(angle + theta / 2) * cornerRadius / Math.cos(theta / 2);
  1139.       cy = y + cornerRadius + Math.sin(angle + theta / 2) * cornerRadius / Math.cos(theta / 2);
  1140.       px = x + w - cornerRadius + Math.cos(angle + theta) * cornerRadius;
  1141.       py = y + cornerRadius + Math.sin(angle + theta) * cornerRadius;
  1142.       this.curveTo(cx,cy,px,py);
  1143.       this.lineTo(x + w,y + h - cornerRadius);
  1144.       angle += theta;
  1145.       cx = x + w - cornerRadius + Math.cos(angle + theta / 2) * cornerRadius / Math.cos(theta / 2);
  1146.       cy = y + h - cornerRadius + Math.sin(angle + theta / 2) * cornerRadius / Math.cos(theta / 2);
  1147.       px = x + w - cornerRadius + Math.cos(angle + theta) * cornerRadius;
  1148.       py = y + h - cornerRadius + Math.sin(angle + theta) * cornerRadius;
  1149.       this.curveTo(cx,cy,px,py);
  1150.       angle += theta;
  1151.       cx = x + w - cornerRadius + Math.cos(angle + theta / 2) * cornerRadius / Math.cos(theta / 2);
  1152.       cy = y + h - cornerRadius + Math.sin(angle + theta / 2) * cornerRadius / Math.cos(theta / 2);
  1153.       px = x + w - cornerRadius + Math.cos(angle + theta) * cornerRadius;
  1154.       py = y + h - cornerRadius + Math.sin(angle + theta) * cornerRadius;
  1155.       this.curveTo(cx,cy,px,py);
  1156.       this.lineTo(x + cornerRadius,y + h);
  1157.       angle += theta;
  1158.       cx = x + cornerRadius + Math.cos(angle + theta / 2) * cornerRadius / Math.cos(theta / 2);
  1159.       cy = y + h - cornerRadius + Math.sin(angle + theta / 2) * cornerRadius / Math.cos(theta / 2);
  1160.       px = x + cornerRadius + Math.cos(angle + theta) * cornerRadius;
  1161.       py = y + h - cornerRadius + Math.sin(angle + theta) * cornerRadius;
  1162.       this.curveTo(cx,cy,px,py);
  1163.       angle += theta;
  1164.       cx = x + cornerRadius + Math.cos(angle + theta / 2) * cornerRadius / Math.cos(theta / 2);
  1165.       cy = y + h - cornerRadius + Math.sin(angle + theta / 2) * cornerRadius / Math.cos(theta / 2);
  1166.       px = x + cornerRadius + Math.cos(angle + theta) * cornerRadius;
  1167.       py = y + h - cornerRadius + Math.sin(angle + theta) * cornerRadius;
  1168.       this.curveTo(cx,cy,px,py);
  1169.       this.lineTo(x,y + cornerRadius);
  1170.       angle += theta;
  1171.       cx = x + cornerRadius + Math.cos(angle + theta / 2) * cornerRadius / Math.cos(theta / 2);
  1172.       cy = y + cornerRadius + Math.sin(angle + theta / 2) * cornerRadius / Math.cos(theta / 2);
  1173.       px = x + cornerRadius + Math.cos(angle + theta) * cornerRadius;
  1174.       py = y + cornerRadius + Math.sin(angle + theta) * cornerRadius;
  1175.       this.curveTo(cx,cy,px,py);
  1176.       angle += theta;
  1177.       cx = x + cornerRadius + Math.cos(angle + theta / 2) * cornerRadius / Math.cos(theta / 2);
  1178.       cy = y + cornerRadius + Math.sin(angle + theta / 2) * cornerRadius / Math.cos(theta / 2);
  1179.       px = x + cornerRadius + Math.cos(angle + theta) * cornerRadius;
  1180.       py = y + cornerRadius + Math.sin(angle + theta) * cornerRadius;
  1181.       this.curveTo(cx,cy,px,py);
  1182.    }
  1183.    else
  1184.    {
  1185.       this.moveTo(x,y);
  1186.       this.lineTo(x + w,y);
  1187.       this.lineTo(x + w,y + h);
  1188.       this.lineTo(x,y + h);
  1189.       this.lineTo(x,y);
  1190.    }
  1191. };
  1192. MovieClip.prototype.getCenterPoint = function()
  1193. {
  1194.    return {x:this._width / 2,y:this._height / 2};
  1195. };
  1196. MovieClip.prototype.drawDebugBorderD = function()
  1197. {
  1198.    this.lineStyle(1,0,25);
  1199.    var x;
  1200.    var y = 0;
  1201.    var w = this._width;
  1202.    var h = this._height;
  1203.    this.moveTo(x,y);
  1204.    this.lineTo(x + w,y);
  1205.    this.lineTo(x + w,y + h);
  1206.    this.lineTo(x,y + h);
  1207.    this.lineTo(x,y);
  1208. };
  1209. MovieClip.prototype.drawUnderline = function(len)
  1210. {
  1211.    len = len != null ? len : this._width;
  1212.    this.moveTo(0,this._height);
  1213.    this.lineTo(len,this._height);
  1214. };
  1215. if(PMSI.DepthManager == undefined)
  1216. {
  1217.    PMSI.DepthManager = {};
  1218.    PMSI.DepthManager._$depth = 0;
  1219.    PMSI.DepthManager.getNextDepth = function()
  1220.    {
  1221.       var next_depth = ++this._$depth;
  1222.       while(this._$depthsClaimed["dc" + next_depth])
  1223.       {
  1224.          next_depth = ++this._$depth;
  1225.       }
  1226.       return next_depth;
  1227.    };
  1228.    PMSI.DepthManager.reserveDepth = function(d)
  1229.    {
  1230.       if(this._$depthsClaimed == null)
  1231.       {
  1232.          this._$depthsClaimed = {};
  1233.       }
  1234.       if(d == null)
  1235.       {
  1236.          var d = ++this._$depth;
  1237.       }
  1238.       while(this._$depthsClaimed["dc" + d])
  1239.       {
  1240.          d++;
  1241.       }
  1242.       this._$depthsClaimed["dc" + d] = d;
  1243.       return d;
  1244.    };
  1245. }
  1246. ActivityInfoItem.prototype.toString = function()
  1247. {
  1248.    return this.text;
  1249. };
  1250. ActivityInfo.prototype.getIdString = function(separator)
  1251. {
  1252.    var sep = separator != null ? separator : ".";
  1253.    var idStr = "C" + this.activity.course + sep;
  1254.    idStr += "U" + this.activity.unit + sep;
  1255.    idStr += "S" + this.activity.section + sep;
  1256.    idStr += this.activity.topic + sep;
  1257.    if(this.activity.topicSet)
  1258.    {
  1259.       idStr += this.activity.topicSet + sep;
  1260.    }
  1261.    idStr += this.activity.difficultyLevel + this.activity.number.text;
  1262.    return idStr;
  1263. };
  1264. ActivityInfo.prototype.getId = ActivityInfo.prototype.getIdString;
  1265. ActivityInfo.prototype.getType = function()
  1266. {
  1267.    return this.activity.type;
  1268. };
  1269. ActivityInfo.prototype.hasAudio = function()
  1270. {
  1271.    return this.activity.audioFile == null ? false : true;
  1272. };
  1273. ActivityInfo.prototype.hasVideo = function()
  1274. {
  1275.    return this.activity.videoFile == null ? false : true;
  1276. };
  1277. ActivityInfo.prototype.hasPicture = function()
  1278. {
  1279.    return this.activity.artFile == null ? false : true;
  1280. };
  1281. ActivityInfo.prototype.setResolve = function()
  1282. {
  1283.    this.__resolve = ActivityInfo.prototype._myResolve;
  1284. };
  1285. ActivityInfo.prototype._myResolve = function(name)
  1286. {
  1287.    return this.activity[name];
  1288. };
  1289. ActivityInfo.prototype.getBytesLoaded = function()
  1290. {
  1291.    return this.xmlSource.getBytesLoaded();
  1292. };
  1293. ActivityInfo.prototype.getBytesTotal = function()
  1294. {
  1295.    return this.xmlSource.getBytesTotal();
  1296. };
  1297. ActivityInfo.prototype.load = function(url)
  1298. {
  1299.    this._reset();
  1300.    this.xmlSource = new XML();
  1301.    var x = this.xmlSource;
  1302.    x.parent = this;
  1303.    x.ignoreWhite = true;
  1304.    x.createAttributeArray = function(attrs)
  1305.    {
  1306.    };
  1307.    x.onLoad = function(success)
  1308.    {
  1309.       function helperR(node_xml, obj)
  1310.       {
  1311.          if(node_xml == null)
  1312.          {
  1313.             return undefined;
  1314.          }
  1315.          var nName = node_xml.nodeName;
  1316.          if(nName == "number")
  1317.          {
  1318.             nName = "activityNumber";
  1319.          }
  1320.          if(nName != null && obj[nName] == null)
  1321.          {
  1322.             var newObj = new ActivityInfoItem();
  1323.             newObj.text = node_xml.text.trim();
  1324.             if(node_xml.attributes)
  1325.             {
  1326.                trace("creating new attributes array");
  1327.                newObj.attributes = {};
  1328.                for(var oname in node_xml.attributes)
  1329.                {
  1330.                   newObj.attributes[oname] = node_xml.attributes[oname];
  1331.                }
  1332.             }
  1333.             obj[nName] = newObj;
  1334.          }
  1335.          else if(!(obj[nName] instanceof Array) && obj[nName] != null)
  1336.          {
  1337.             var temp = obj[nName];
  1338.             obj[nName] = [];
  1339.             obj[nName].push(temp);
  1340.          }
  1341.          var childObject = obj[nName];
  1342.          if(childObject instanceof Array)
  1343.          {
  1344.             var newObj = new ActivityInfoItem();
  1345.             newObj.text = node_xml.text.trim();
  1346.             if(node_xml.attributes)
  1347.             {
  1348.                trace("creating new attributes array");
  1349.                newObj.attributes = {};
  1350.                for(var oname in node_xml.attributes)
  1351.                {
  1352.                   newObj.attributes[oname] = node_xml.attributes[oname];
  1353.                }
  1354.             }
  1355.             childObject = newObj;
  1356.             obj[nName].push(childObject);
  1357.          }
  1358.          helperR(node_xml.firstChild,childObject);
  1359.          helperR(node_xml.nextSibling,obj);
  1360.       }
  1361.       if(success)
  1362.       {
  1363.          helperR(this.firstChild,this.parent);
  1364.          this.parent.setResolve();
  1365.       }
  1366.       this.parent.onLoad(success);
  1367.    };
  1368.    x.load(url);
  1369. };
  1370. ActivityInfo.prototype._reset = function()
  1371. {
  1372.    delete this.xmlSource;
  1373.    delete this.__resolve;
  1374.    delete this.activity;
  1375. };
  1376. TableClass = function(parent)
  1377. {
  1378.    this.parent = parent;
  1379.    this.reduceTextFields = true;
  1380.    this.rows = [];
  1381.    this.maxCellDims = {width:0,height:0};
  1382.    this.cellPadding = 4;
  1383.    this.cellSpacing = 4;
  1384.    this.colWidthMaxs = [];
  1385.    this.colPercentTable = [];
  1386.    this.borderSize = 1;
  1387.    this.width = 0;
  1388.    this.height = 0;
  1389.    this.oldWidth = this.width;
  1390.    this.oldHeight = this.oldHeight;
  1391.    this.originalWidth = 0;
  1392.    this.x = 0;
  1393.    this.y = 0;
  1394.    this.alteredColumns = {};
  1395.    var dep = PMSI.DepthManager.getNextDepth();
  1396.    this.borderClip = parent.createEmptyMovieClip("TableClassBorder" + dep,dep);
  1397. };
  1398. TableClass.prototype.setPosition = function(position)
  1399. {
  1400.    this.x = position.x;
  1401.    this.y = position.y;
  1402. };
  1403. TableClass.prototype.getPosition = function()
  1404. {
  1405.    return {x:this.x,y:this.y};
  1406. };
  1407. TableClass.prototype.setBorder = function(bsize)
  1408. {
  1409.    this.borderSize = bsize;
  1410. };
  1411. TableClass.prototype.addRow = function(newRow)
  1412. {
  1413.    this.rows.push(newRow);
  1414.    var cells = newRow.cells;
  1415.    var cellCount = cells.length;
  1416.    var cwms = this.colWidthMaxs;
  1417.    var cw = null;
  1418.    var newWidth = 0;
  1419.    var con = null;
  1420.    var c = 0;
  1421.    while(c < cellCount)
  1422.    {
  1423.       con = cells[c].getContent();
  1424.       cw = con == null ? cells[c].width : con._width;
  1425.       if(cwms[c] == null)
  1426.       {
  1427.          cwms[c] = cw;
  1428.       }
  1429.       else
  1430.       {
  1431.          cwms[c] = cw <= cwms[c] ? cwms[c] : cw;
  1432.       }
  1433.       newWidth += cwms[c];
  1434.       c++;
  1435.    }
  1436.    this.originalWidth = newWidth;
  1437.    this.width = newWidth;
  1438.    trace("NEW WIDTH: " + this.width);
  1439. };
  1440. TableClass.prototype.addRowSpacer = function(height, width, numCols)
  1441. {
  1442.    if(numCols == null && this.rows.length == 0)
  1443.    {
  1444.       return undefined;
  1445.    }
  1446.    numCols = this.rows[0].cells.length;
  1447.    var spacerRow = new TableRow();
  1448.    var spacerCell = null;
  1449.    var i = 0;
  1450.    while(i < numCols)
  1451.    {
  1452.       spacerCell = new TableCell();
  1453.       spacerCell.height = height;
  1454.       spacerCell.width = width;
  1455.       spacerRow.addCell(spacerCell);
  1456.       i++;
  1457.    }
  1458.    this.addRow(spacerRow);
  1459. };
  1460. TableClass.prototype.setCellPadding = function(cellPadding)
  1461. {
  1462.    this.cellPadding = cellPadding;
  1463.    this.redraw();
  1464. };
  1465. TableClass.prototype.setCellSpacing = function(cellSpacing)
  1466. {
  1467.    this.cellSpacing = cellSpacing;
  1468.    this.redraw();
  1469. };
  1470. TableClass.prototype.setWidth = function(width)
  1471. {
  1472.    this.oldWidth = this.width;
  1473.    this.width = width;
  1474.    this._recalcDimensions(width);
  1475.    this.redraw();
  1476.    this.redraw();
  1477. };
  1478. TableClass.prototype.setHeight = function(height)
  1479. {
  1480.    this.oldHeight = this.height;
  1481.    this.height = height;
  1482.    this.redraw();
  1483. };
  1484. TableClass.prototype.redraw = function()
  1485. {
  1486.    this.borderClip.clear();
  1487.    var rows = this.rows;
  1488.    var rc = rows.length;
  1489.    var tmdims = this.maxCellDims;
  1490.    var x;
  1491.    var y;
  1492.    var r;
  1493.    var cc;
  1494.    var con;
  1495.    var cols;
  1496.    var rmdims;
  1497.    var cell;
  1498.    var cmax;
  1499.    var offset;
  1500.    var voffset;
  1501.    var cwid;
  1502.    var wprec;
  1503.    var newwid;
  1504.    var lastColMax = null;
  1505.    var cpad = this.cellPadding;
  1506.    var cspace = this.cellSpacing;
  1507.    var r = 0;
  1508.    while(r < rc)
  1509.    {
  1510.       cols = rows[r].cells;
  1511.       cc = cols.length;
  1512.       rmdims = rows[r - 1].maxCellDims;
  1513.       if(r == 0)
  1514.       {
  1515.          y = this.y;
  1516.       }
  1517.       else
  1518.       {
  1519.          y += rmdims.height + this.cellSpacing;
  1520.       }
  1521.       var c = 0;
  1522.       while(c < cc)
  1523.       {
  1524.          cell = cols[c];
  1525.          con = cell.getContent();
  1526.          cwid = this.colWidthMaxs[c];
  1527.          this._resizeTextfield(con,cwid);
  1528.          if(cell.halign == "right")
  1529.          {
  1530.             offset = cwid - con._width;
  1531.          }
  1532.          else if(cell.halign == "center")
  1533.          {
  1534.             offset = (cwid - con._width) / 2;
  1535.          }
  1536.          else
  1537.          {
  1538.             offset = 0;
  1539.          }
  1540.          if(cell.valign == "bottom")
  1541.          {
  1542.             voffset = rows[r].maxCellDims.height - con._height;
  1543.          }
  1544.          else if(cell.valign == "center")
  1545.          {
  1546.             voffset = (rows[r].maxCellDims.height - con._height) / 2;
  1547.          }
  1548.          else
  1549.          {
  1550.             voffset = 0;
  1551.          }
  1552.          if(c == 0)
  1553.          {
  1554.             x = this.x;
  1555.             lastColMax = cwid;
  1556.          }
  1557.          else
  1558.          {
  1559.             cmax = lastColMax;
  1560.             x += cmax + this.cellSpacing;
  1561.          }
  1562.          con._x = x + offset;
  1563.          con._y = y + voffset;
  1564.          if(this.borderSize > 0)
  1565.          {
  1566.             this.borderClip.lineStyle(this.borderSize,10066329,100);
  1567.             this.borderClip.drawRect(x,y,cwid,rows[r].maxCellDims.height);
  1568.          }
  1569.          lastColMax = cwid;
  1570.          c++;
  1571.       }
  1572.       r++;
  1573.    }
  1574.    this._recalcHeights();
  1575. };
  1576. TableClass.prototype._resizeTextfield = function(oIns, w, h)
  1577. {
  1578.    var txt = oIns.content;
  1579.    if(txt._width > w)
  1580.    {
  1581.       txt.wordWrap = true;
  1582.       txt._width = w;
  1583.       txt._width = Math.round(txt._width);
  1584.       trace("text width: " + txt.textWidth);
  1585.       if(this.reduceTextFields)
  1586.       {
  1587.          var h = txt._height;
  1588.          var w = txt._width;
  1589.          var old_w = 0;
  1590.          var txtWidth = txt.textWidth;
  1591.          var i = w;
  1592.          while(h == txt._height)
  1593.          {
  1594.             if(i <= 0)
  1595.             {
  1596.                break;
  1597.             }
  1598.             if(txt.textWidth < txtWidth)
  1599.             {
  1600.                break;
  1601.             }
  1602.             txt._width--;
  1603.             i--;
  1604.          }
  1605.          txt._width = txt._width + 1;
  1606.       }
  1607.    }
  1608.    oIns._width = txt._width;
  1609. };
  1610. TableClass.prototype._recalcHeights = function()
  1611. {
  1612.    var rows = this.rows;
  1613.    var rc = rows.length;
  1614.    var cc;
  1615.    var cols;
  1616.    var cell;
  1617.    this.height = 0;
  1618.    var r = 0;
  1619.    while(r < rc)
  1620.    {
  1621.       cols = rows[r].cells;
  1622.       cc = cols.length;
  1623.       var c = 0;
  1624.       while(c < cc)
  1625.       {
  1626.          cell = cols[c];
  1627.          rows[r]._checkMaxCellDims(cell);
  1628.          this.height += rows[r].maxCellDims.height;
  1629.          c++;
  1630.       }
  1631.       r++;
  1632.    }
  1633. };
  1634. TableClass.prototype._findLargestColumn = function()
  1635. {
  1636.    var largestId;
  1637.    var largest;
  1638.    var cmaxs = this.colWidthMaxs;
  1639.    var i = 0;
  1640.    while(i < cmaxs.length)
  1641.    {
  1642.       trace("finding largest: " + cmaxs[i]);
  1643.       if(largest < cmaxs[i])
  1644.       {
  1645.          largest = cmaxs[i];
  1646.          largestId = i;
  1647.       }
  1648.       i++;
  1649.    }
  1650.    return largestId;
  1651. };
  1652. TableClass.prototype._recalcDimensions = function(newWidth)
  1653. {
  1654.    var cw = this._getTableWidth();
  1655.    if(newWidth > cw)
  1656.    {
  1657.       return undefined;
  1658.    }
  1659.    trace("\n\n----");
  1660.    trace("TableClass.prototype._recalcDimensions:");
  1661.    trace("current width: " + cw + ", new width: " + newWidth);
  1662.    delete this.alteredColumns;
  1663.    this.alteredColumns = {};
  1664.    this._resizeTableR(cw,newWidth);
  1665.    var addback = newWidth - this._getTableWidth();
  1666.    var cmaxs = this.colWidthMaxs;
  1667.    var prc;
  1668.    var cmax = 0;
  1669.    var acc = 0;
  1670.    for(var nm in this.alteredColumns)
  1671.    {
  1672.       trace("ALTERED COLUMNS: " + nm);
  1673.       if(!isNaN(nm))
  1674.       {
  1675.          acc++;
  1676.       }
  1677.    }
  1678.    for(var colid in this.alteredColumns)
  1679.    {
  1680.       trace("Addback: " + colid + ", " + addback / acc);
  1681.       this.colWidthMaxs[parseInt(colid)] = this.colWidthMaxs[parseInt(colid)] + addback / acc;
  1682.    }
  1683.    if(addback / acc > 0)
  1684.    {
  1685.    }
  1686.    this.width = newWidth;
  1687. };
  1688. TableClass.prototype._resizeTableR = function(lastWidth, targetWidth)
  1689. {
  1690.    if(lastWidth <= targetWidth)
  1691.    {
  1692.       return undefined;
  1693.    }
  1694.    var largest;
  1695.    var largestId = 0;
  1696.    var cmaxs = this.colWidthMaxs;
  1697.    var i = 0;
  1698.    while(i < cmaxs.length)
  1699.    {
  1700.       trace("finding largest: " + cmaxs[i]);
  1701.       if(largest < cmaxs[i])
  1702.       {
  1703.          largest = cmaxs[i];
  1704.          largestId = i;
  1705.       }
  1706.       i++;
  1707.    }
  1708.    var prc = largest / lastWidth;
  1709.    trace("prc: " + prc);
  1710.    var ncw = largest * prc;
  1711.    cmaxs[largestId] = ncw;
  1712.    this.alteredColumns[largestId] = largestId;
  1713.    trace("\n\nAFTER:");
  1714.    trace("new largest: " + ncw);
  1715.    trace("lastWidth: " + lastWidth);
  1716.    trace("largest: " + largest);
  1717.    trace("targetWidth: " + targetWidth);
  1718.    trace("nextWidth: " + (lastWidth - (largest - ncw)));
  1719.    if(prc == 1)
  1720.    {
  1721.       cmax[largestId] = targetWidth;
  1722.       return undefined;
  1723.    }
  1724.    this._resizeTableR(lastWidth - (largest - ncw),targetWidth);
  1725. };
  1726. TableClass.prototype._getTableWidth = function()
  1727. {
  1728.    var width = 0;
  1729.    var lasti = this.colWidthMaxs.length - 1;
  1730.    var i = 0;
  1731.    while(i < this.colWidthMaxs.length)
  1732.    {
  1733.       width += this.colWidthMaxs[i];
  1734.       i++;
  1735.    }
  1736.    return width;
  1737. };
  1738. TableClass.prototype.init = function()
  1739. {
  1740.    this.redraw();
  1741. };
  1742. TableRow = function()
  1743. {
  1744.    this.cells = [];
  1745.    this.maxCellDims = {width:0,height:0};
  1746. };
  1747. TableRow.prototype.addCell = function(cell)
  1748. {
  1749.    this.cells.push(cell);
  1750.    var cc = cell.getContent();
  1751.    var cw = cc == null ? cell.width : cc._width;
  1752.    var ch = cc == null ? cell.height : cc._height;
  1753.    var mw = this.maxCellDims.width;
  1754.    var mh = this.maxCellDims.height;
  1755.    this.maxCellDims.width = cw <= mw ? mw : cw;
  1756.    this.maxCellDims.height = ch <= mh ? mh : ch;
  1757. };
  1758. TableRow.prototype._checkMaxCellDims = function(cell)
  1759. {
  1760.    var cc = cell.getContent();
  1761.    var cw = cc == null ? cell.width : cc._width;
  1762.    var ch = cc == null ? cell.height : cc._height;
  1763.    var mw = this.maxCellDims.width;
  1764.    var mh = this.maxCellDims.height;
  1765.    this.maxCellDims.width = cw <= mw ? mw : cw;
  1766.    this.maxCellDims.height = ch <= mh ? mh : ch;
  1767. };
  1768. TableCell = function(content)
  1769. {
  1770.    this.content = content;
  1771. };
  1772. TableCell.prototype.setContent = function(content)
  1773. {
  1774.    this.content = content;
  1775. };
  1776. TableCell.prototype.getContent = function()
  1777. {
  1778.    return this.content;
  1779. };
  1780. TableCell.prototype.setWidth = function(width, isPercent)
  1781. {
  1782.    this.widthIsPercent = isPercent != null ? true : false;
  1783.    this.width = width;
  1784. };
  1785. TableCell.prototype.setHeight = function(height, isPercent)
  1786. {
  1787.    this.heightIsPercent = isPercent != null ? true : false;
  1788.    this.height = height;
  1789. };
  1790. TableCell.prototype.setHAlign = function(halign)
  1791. {
  1792.    this.halign = halign;
  1793. };
  1794. TableCell.prototype.setVAlign = function(valign)
  1795. {
  1796.    this.valign = valign;
  1797. };
  1798. Image = function(parent, name, depth, url)
  1799. {
  1800.    this.$keepAspect = true;
  1801.    this.load(parent,name,depth,url);
  1802. };
  1803. Image.prototype.setKeepAspectRatio = function(keepAspect)
  1804. {
  1805.    this.$keepAspect = keepAspect;
  1806. };
  1807. Image.prototype.load = function(parent, name, depth, url)
  1808. {
  1809.    if(parent != null && name != null && depth != null && url != null)
  1810.    {
  1811.       if(!this.$mc)
  1812.       {
  1813.       }
  1814.       this.$parent = parent;
  1815.       this.$name = name;
  1816.       this.$depth = depth;
  1817.       this.$url = url;
  1818.       this.$mc = parent.createEmptyMovieClip(name,depth);
  1819.       this.$mc.drawRect(100,100,100,100);
  1820.       this.$mc._width = 100;
  1821.       this.$mc.onLoad = function()
  1822.       {
  1823.          this.onEnterFrame = function()
  1824.          {
  1825.             if(this._height > 0)
  1826.             {
  1827.                onLoad();
  1828.                delete this.onEnterFrame;
  1829.             }
  1830.          };
  1831.       };
  1832.       this.$mc.onLoad.parent = this;
  1833.       this.$mc.loadMovie(url);
  1834.       return this.$mc;
  1835.    }
  1836. };
  1837. Image.prototype.$_onLoad = function()
  1838. {
  1839.    this.onEnterFrame = function()
  1840.    {
  1841.       if(this._height > 0)
  1842.       {
  1843.          this.onLoad.parent.onLoad.call(this.onLoad.parent,arguments);
  1844.          delete this.onEnterFrame;
  1845.       }
  1846.    };
  1847. };
  1848. Image.prototype.getClipInstance = function()
  1849. {
  1850.    return this.$mc;
  1851. };
  1852. Image.prototype.setWidth = function(width)
  1853. {
  1854.    if(this.$keepAspect)
  1855.    {
  1856.       if(this.$aspectRatio == null)
  1857.       {
  1858.          this.$setAspectRatio();
  1859.       }
  1860.       this.$mc._xscale = width / this.$mc._width * 100;
  1861.       this.$mc._yscale = this.$mc._xscale;
  1862.    }
  1863.    else
  1864.    {
  1865.       this.$mc._width = width;
  1866.    }
  1867. };
  1868. Image.prototype.setHeight = function(height)
  1869. {
  1870.    if(this.$keepAspect)
  1871.    {
  1872.       this.$mc._yscale = height / this.$mc._height * 100;
  1873.       this.$mc._xscale = this.$mc._yscale;
  1874.    }
  1875.    else
  1876.    {
  1877.       this.$mc._height = height;
  1878.    }
  1879. };
  1880. Image.prototype.resize = function(width, height)
  1881. {
  1882.    this.setWidth(width);
  1883.    this.setHeight(height);
  1884. };
  1885. Image.prototype.$setAspectRatio = function()
  1886. {
  1887.    this.$aspectRatio = this.$mc._width <= this.$mc._height ? this.$mc._height / this.$mc._width : this.$mc._width / this.$mc._height;
  1888. };
  1889. stop();
  1890. bubbleDepthCounter = 70000;
  1891. lineColor = 2309272;
  1892. lineAlpha = 100;
  1893. bubblePlayCounter = 1;
  1894. bubblePlayMax = 99999;
  1895. bubbleHelpSleepTime = 10;
  1896. testFile = "activities/data/C3.U1.S1.EC.A1.xml";
  1897. if(_parent)
  1898. {
  1899.    master = _parent;
  1900. }
  1901. else
  1902. {
  1903.    master = this;
  1904. }
  1905. if(master.layoutInfo == null)
  1906. {
  1907.    var layoutInfo = {};
  1908.    layoutInfo.titleTextColor = 3636920;
  1909.    layoutInfo.answerRollOverColor = 16695085;
  1910.    layoutInfo.answerRollOutColor = 3636920;
  1911.    layoutInfo.answerSelectColor = 2309272;
  1912.    layoutInfo.questionTextColor = 2309272;
  1913.    layoutInfo.instTextColor = 2309272;
  1914.    layoutInfo.doAnswerFill = false;
  1915.    layoutInfo.rightSideBuffer = 10;
  1916.    layoutInfo.box = {};
  1917.    layoutInfo.box.x = 260;
  1918.    layoutInfo.box.y = 98;
  1919.    layoutInfo.box.views = [];
  1920.    layoutInfo.box.widthWithBox = 300;
  1921.    layoutInfo.box.heightWithBox = 300;
  1922.    layoutInfo.box.widthWithoutBox = 300;
  1923.    layoutInfo.box.heightWithoutBox = 300;
  1924.    layoutinfo.MAX_WIDTH = 520;
  1925.    layoutInfo.MAX_HEIGHT = 380;
  1926.    layoutInfo.questionIndent = 30;
  1927.    layoutInfo.selectionRadius = 6;
  1928.    layoutInfo.drawSelectionCircle = true;
  1929.    layoutInfo.lineSpacing = 5;
  1930.    layoutInfo.selectionBorderThickness = 1;
  1931.    layoutInfo.instTextFormat = new TextFormat();
  1932.    layoutInfo.instTextFormat.font = "Formata_Bold";
  1933.    layoutInfo.instTextFormat.size = 12;
  1934.    layoutInfo.instTextFormat.color = layoutInfo.instTextColor;
  1935.    layoutInfo.qTextFormat = new TextFormat();
  1936.    layoutInfo.qTextFormat.font = "Formata_Normal";
  1937.    layoutInfo.qTextFormat.size = 12;
  1938.    layoutInfo.qTextFormat.color = layoutInfo.questionTextColor;
  1939.    layoutInfo.qTextFormat.align = "right";
  1940.    layoutInfo.answerTextFormat1 = new TextFormat();
  1941.    layoutInfo.answerTextFormat1.font = "Formata_Normal";
  1942.    layoutInfo.answerTextFormat1.size = 12;
  1943.    layoutInfo.answerTextFormat1.color = layoutInfo.answerRollOutColor;
  1944.    layoutInfo.answerTextFormat2 = new TextFormat();
  1945.    layoutInfo.answerTextFormat2.font = "Formata_Normal";
  1946.    layoutInfo.answerTextFormat2.size = 12;
  1947.    layoutInfo.answerTextFormat2.color = layoutInfo.answerRollOutColor;
  1948.    layoutInfo.titleTextFormat = new TextFormat();
  1949.    layoutInfo.titleTextFormat.font = "TriplexCondSerifBlack";
  1950.    layoutInfo.titleTextFormat.size = 24;
  1951.    layoutInfo.titleTextFormat.color = layoutInfo.titleTextColor;
  1952.    layoutInfo.matchingCircleColor = 16695085;
  1953.    layoutInfo.matchingCircleRadius = 4;
  1954.    layoutInfo.matchingCircleSpacer = 50;
  1955.    layoutInfo.matchingCircleLineThickness = 2;
  1956.    layoutInfo.matchingCircleVertOffset = 4;
  1957. }
  1958. else
  1959. {
  1960.    layoutInfo = master.layoutInfo;
  1961. }
  1962. layoutInfo.temp4InstWidth = 250;
  1963. layoutInfo.temp4InstY = 305;
  1964. var ai = new ActivityInfo();
  1965. ai._parent = this;
  1966. ai.onLoad = function(success)
  1967. {
  1968.    trace("id:   " + this.getIdString());
  1969.    trace("type: " + this.type);
  1970.    var i = 0;
  1971.    while(i < this.questions.question.length)
  1972.    {
  1973.       trace(i + 1 + ". " + this.questions.question[i].questionText);
  1974.       i++;
  1975.    }
  1976.    this._parent.render();
  1977.    trace("Time: " + (getTimer() - t) / 1000);
  1978. };
  1979. if(_parent == null)
  1980. {
  1981.    loadActivity(testFile);
  1982. }
  1983. pencilSelected = false;
  1984. pencil.swapDepths(60001);
  1985. pencilHelper.swapDepths(70000);
  1986. pencil._visible = false;
  1987. needsTip = true;
  1988. container = this;
  1989. container.drawPoints = 4;
  1990. container.drawLines_mcs = {};
  1991. container.drawLines_mcs.level = 10000;
  1992. container._snapLines = true;
  1993. container._snapAfter = false;
  1994. pencil.onRelease = function()
  1995. {
  1996.    pencilSelected = true;
  1997.    pencilHolder.onRelease = pencilHolderRelease;
  1998.    Mouse.hide();
  1999.    pencil.onMouseMove = function()
  2000.    {
  2001.       this._x = _root._xmouse;
  2002.       this._y = _root._ymouse;
  2003.       updateAfterEvent();
  2004.    };
  2005. };
  2006.